home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group97b.txt
/
000010_icon-group-sender _Wed Jul 2 23:33:27 1997.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
1KB
Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Tue, 8 Jul 1997 08:43:27 MST
Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM)
id AA24479; Tue, 8 Jul 1997 08:43:26 -0700
Message-Id: <3.0.1.32.19970702233327.007cad30@alterdial.uu.net>
X-Sender: mail08621@alterdial.uu.net
X-Mailer: Windows Eudora Pro Version 3.0.1 (32)
Date: Wed, 02 Jul 1997 23:33:27 -0500
To: icon-group@cs.arizona.edu
From: Jerry Nowlin <nowlin@nowlin.com>
Subject: Re: A small puzzle (never fails)
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
>I couldn't resist. I have an Icon solution:
>
> # the longest common prefix procedure
> procedure lcp(a,b); return a ? tab(match(b[1:*b to 0 by -1])); end
Insufficient testing rigor. If the original strings are identical the
above loses the last character of the lcp. Try this one:
procedure lcp(a,b); return a ? tab(match(b[1:*b+1 to 1 by -1])); end
I have to remember Icon starts with 1, not 0 :-) Sorry.
Jerry Nowlin
Jerry Nowlin
nowlin@nowlin.com
http://www.xnet.com/~nowlin/